<?php
/*
 * V3 版本，公有接口
 * 完整路由是 api.laohoulundao.com/api/v3/xxx
 * */
$api        = app('Dingo\Api\Routing\Router');             // API 路由接管
$options    = [
        'namespace'     => 'App\Http\Controllers\Api\V6',
        'prefix'        => 'api/v6',
        'middleware'    => ['saveApiData','changeCodeType']
    ];


$api->version('v1',$options,function($api){
    $api->post('/useDeviceInfo', 'AppUseMessageController@use_device_info');    //app使用情况统计
});

$options['middleware']  =   ['saveApiData'];

/*无需TOKEN即可访问的接口*/

$api->version('v1', $options, function ($api) {

    /*=======首页==========*/      
    //$api->post('/home/home', 'HomeController@home');                          //首页 综合数据
    $api->post('/home/{action}','HomeController@action');                       //首页
    $api->post('/audio/{action}',"AudioController@action");                     //音频 

    $api->post('/company/{action}',"CompanyController@action");                 //企业
    $api->post('/audio/pageAudio',     'AudioController@page_audio');           //音频分页    
    
    $api->post('/readparty/{action}',  'ReadingPartyController@action');        //读书会

    $api->post('/companyQuestion/{action}',"CompanyQuestionController@action");

    $api->post('/message/{action}',     "MessageController@action");            //消息

    $api->any('/bookSentence/{action}',"BookSentenceController@action");        //书籍摘抄

    /*=======用户==========*/
    $api->any("/country/{action}","CountryController@action");
    
    $api->post("/member/{action}",  "MemberController@action");

    $api->post('/login',    'MemberController@login');              //会员-登录
    
    $api->post('/checkmobile', 'MemberController@checkMobile');        //会员-检查用户是否存在
    $api->post('/register', 'MemberController@register');           //会员-注册
    $api->post('/register-mobile-v3', 'MemberController@register');           //会员-注册
    

    $api->post('/checkmobcode', 'MemberController@check_mobile_code');       //检查验证码

    
   /*============== 书籍 begin ============*/
    $api->post('/book/{action}', 'BookController@action'); //推荐书籍

    $api->post('/booktypelist', 'BookController@getBookType');          //书籍分类
    $api->post('/book/freeBooks','BookController@free_books');          //免费视频

    $api->post('/bookrecommendlist', 'BookController@getBookRecommendList'); //推荐书籍
    $api->any('/booklist',      'BookController@getBookList');               //获取书籍列表页
    $api->any('/booklistOther', 'BookController@getBookList_other');               //获取书籍列表页

    /*============== 书籍 end  ============*/


    /*=======其他==========*/          
    $api->post('/mediaPlayLog', 'HomeController@media_play_log');   //媒体播放统计日志
    $api->post('/addmessage', 'MemberController@suggestionsStore');   //意见反馈

    $api->post('/memberOnlineLog', 'AppUseMessageController@member_online_log'); //app使用时间记录
    $api->post('/audio/record_view_times', 'AudioController@record_view_times'); //记录播放次数
    $api->post('/wxShareLog', 'HomeController@wx_share_log');     //微信分享日志

    //微信支付
    $api->post('/weixin/livePayCallback',   'WeiXinController@live_pay_callback');
    $api->post('/weixin/lhldPayCallback',   'WeiXinController@lhld_pay_callback');

    $api->post('/weixin/getWxPayOrders',    'WeiXinController@get_wx_pay_orders');

    $api->post('/weixin/{action}',          "WeiXinController@action");

      /*======== 与支付相关 =======*/
    $api->any('/pay/log_ios_pay', 'PayController@log_ios_pay');
    $api->post('pay/add_order', 'PayController@add_order');
    $api->post('pay/check_ios_pay_result', 'PayController@check_ios_pay_result');

    
});






//array_unset_value($options['middleware'],'checkTokenSome');
//array_push($options['middleware'], 'checkTokenAll');

//需要检查token

$api->version('v1', $options, function ($api) {

    /*====老侯论道====*/
    $api->post('/audioDayly/collectLundao', 'AudioController@collect_lundao');      //收藏老侯论道 

    /*=========用户========*/
   
    $api->post('/loginout', 'MemberController@login_out');          //会员-退出登录
    $api->post('/memberdetail', 'MemberController@get_member_info');    //会员详细

    $api->post('/memimg', 'MemberController@upload_member_head_img'); //上传头像
    $api->post('/memupdate', 'MemberController@update_member_name');     //修改会员名称
    $api->post('/update_member_info', 'MemberController@update_member_info');//修改会员资料


    $api->post('/membersumup',            'MemberCenterController@getMemBookSumUp');      //读书改进计划
    $api->post('/member/getCollected',    'MemberController@get_collected');        //收藏记录
    $api->post('/member/delCollected',    'MemberController@delete_collected');    //收藏记录

    $api->post('/memberviewlog',    'MemberCenterController@getMemBookViewLog');    //观看记录
    $api->post('/memdelcollect',    'MemberCenterController@delMemBookCollect');    //删除收藏
    $api->post('/memberrenew',      'MemberCenterController@getMemRenew');          //缴费记录


    $api->post('/bookcollect', 'BookController@bookCollectStore');  //收藏 书籍
    $api->post('/sendBookPpt', 'BookController@send_book_ppt');      //获得书籍PPT邮件
    $api->post('/book/addScore','BookController@add_score');        //添加评分

    $api->post('/book/getGzIndex', 'BookController@gz_index');             //获取国政视频列表
    $api->post('/book/getGzVideos', 'BookController@get_gz_videos');        //获取国政视频列表
    $api->post('/book/getGzVideoDetail', 'BookController@get_gz_video_detail');  //国政书吧详细页面


    /*============== 书籍 begin ============*/

    $api->post('/partnerdetail', 'MemberDRPController@memDRPDetail');            //合伙人详细
    $api->post('/commissionlist', 'MemberDRPController@commission');              //佣金和提现记录
    $api->post('/banknamelist', 'MemberDRPController@getBankName');             //银行接口
    $api->post('/paycardlist', 'MemberDRPController@paycard');                 //提现账号列表
    $api->post('/addmemalicard', 'MemberDRPController@aliPayCardStore');         //添加提现账号--支付宝
    $api->post('/addmembankcard', 'MemberDRPController@bankPayCardStore');        //添加提现账号--银行卡
    $api->post('/updefault', 'MemberDRPController@upPayCardDefault');        //设置默认提现账号
    $api->post('/addmobpaycode', 'MemberDRPController@addMobCode');              //发送提现短信验证

    $api->post('/invoicelist', 'MemberDRPController@invoiceInfo');         //发票信息
    $api->post('/drawmoney', 'MemberDRPController@withdrawMoneyStore');  //提现申请
    $api->post('/friendlist', 'MemberDRPController@memFriendList');   //我的好友
    $api->post('/defaulttemp', 'MemberDRPController@defaultTemplate'); //推荐好友
    $api->post('/addtempimg', 'MemberDRPController@temoImgStore');    //生成模板


    /***=========== 读书会--开始 ==========***/

    $api->post('/modifyindividual', 'ReadingPartyController@add_personal_read_party');                  //个人
    $api->post('/add_personal_read_party', 'ReadingPartyController@add_personal_read_party');           //添加 个人读书会

    $api->post('/modifyenterprise', 'ReadingPartyController@add_company_read_party_v3');                //企业
    $api->post('/add_company_read_party', 'ReadingPartyController@add_company_read_party_v3');          //添加 企业读书会


    $api->post('/quitgroup', 'ReadingPartyController@quit_read_party');         //退出读书会

    $api->post('/groupview', 'ReadingPartyController@readingPartydetail');      //查看读书会
    $api->post('/addzan', 'ReadingPartyController@zanStore');                   //点赞改进计划

    $api->post('/sumupcommentlist', 'ReadingPartyController@sumupComment');         //全部评论

    $api->post('/addreply', 'ReadingPartyController@add_read_plan_comment');    //发表评论


    $api->post('/upgroupface', 'ReadingPartyController@update_read_party_img');             //修改读书会头像
    $api->post('/update_read_party_info', 'ReadingPartyController@update_read_party_info');//修改读书会信息


    $api->post('/addaward', 'AwardPlanController@awardPlanStore');                  //添加读书会奖励规则
    $api->post('/awarddetail', 'AwardPlanController@getAwardPlanDetail');           //读取读书会奖励学习币
    $api->post('/resetmoney', 'AwardPlanController@resetMoneyAll');                 //清空学习币

    /*** 读书会--结束 ***/


    /*** 2017-04-18 读书会修改 ***/
    
    $api->post('/get_read_plan_info', 'ReadingPartyController@get_read_plan_info');                   //单条读书计划信息
    $api->post('/mobilelist', 'ReadingPartyController@check_member_mobile_list');                       //通讯录

    $api->post('/modifyauditmember', 'ReadingPartyController@add_read_party_member');                //邀请会员加入读书会
    $api->post('/add_read_party_member', 'ReadingPartyController@add_read_party_member');            //邀请会员加入读书会
    $api->post('/update_read_party_member', 'ReadingPartyController@update_read_party_member');      //修改读书会会员


    $api->post('/modifygift', 'ReadingPartyController@read_party_book_gift');                 //赠礼物
    $api->post('/read_party_member_detail', 'ReadingPartyController@read_party_member_detail');         //管理员读取所有群成员
    $api->post('/quitgroupadmin', 'ReadingPartyController@manager_remove_read_party_member');     //管理员删除读书会成员
    $api->post('/modifyregulation', 'ReadingPartyController@update_read_party_gulation');           //管理员修改群规

    $api->post('/singlesan', 'AwardPlanController@award_read_plan');                          //单个更新学习币
    $api->post('/bluksinglesan', 'AwardPlanController@blukSingleSanStore');                       //批量更新学习币
    $api->post('/multiReward', 'AwardPlanController@blukSingleSanStore');                      //批量更新学习币

    $api->post('/moneylog', 'AwardPlanController@getMemberMoneyLog');                       //学习币获取记录

    $api->post('/get_department', "CompanyController@get_department");                //获取部门
    $api->post('/companySource', "CompanyController@company_source");                //公司资源
    $api->post('/pageCompanySource', "CompanyController@page_company_source");           //公司资源分页
    $api->post('/detailCompanySource', "CompanyController@detail_company_source");         //公司资源详情

    $api->post('/company/acceptAnswer', "CompanyQuestionController@accept_answer");             //采纳答案
    $api->post('/company/addQuestion', "CompanyQuestionController@add_question");              //添加问题



    /*** 2017-04-18 读书会修改--结束 ***/

    
    $api->any('/home/showImages', 'ApiHomeController@showImages');    //首页轮播图接口 使用
   
    
    /*====== 文章评论接口 ========*/
    $api->any('/homedetail', 'ApiHomeController@homedetail');    //获取热点推荐／自学习社区详情页 √
    
    $api->any('/apiHome/{action}','ApiHomeController@action');  //首页



    $api->any('/setComment', 'ApiHomeController@setComment');    //热点推荐／自学习社区评论
    $api->any('/getComment', 'ApiHomeController@getComment');    //显示评论
    $api->any('/get_video_or_article_comment_share_info', 'ApiHomeController@get_video_or_article_comment_share_info');

    /*======== 消息接口 ========*/
    $api->any('/message/get_user_message', 'MessageController@get_user_message');
    $api->any('/message/get_unreaded_message_number', 'MessageController@get_unreaded_message_number');

  

    


    //==================================================v3---最新---========================================
    $api->post('/lessons/video/info', 'LessonsClassRoomController@index'); //获取学习官课堂的课程

    $api->post('/lessons/{id?}', 'LessonsClassRoomController@lessons');   //获取某一个课程分类的所有的课程

    $api->post('/lesson/{id?}', 'LessonsClassRoomController@lesson'); //获取某一个视频课程的详细的信息

    $api->post('/deleteComment', 'LessonsClassRoomController@delete_comment'); //删除掉某一个评论

    $api->post('/clo/index', 'CloMemberInfoController@index');//获取clo的所有的会员信息

    $api->post('/lessons/center/index', 'LearningOfficerMatterController@index');//获取学习官中心的文章

    $api->post('/CategoryIdArticle/{lessonsCategoryId?}', 'LearningOfficerMatterController@show');//获取某一个分类文章下面的所有的文章


//  $api->post('/lessons/matter/{articleId?}/{userPhone?}', 'LearningOfficerMatterController@get_article_detail');//获取课程的详细的信息

    $api->post('/lessonsDetail', 'LearningOfficerMatterController@get_article_detail');//获取某一个文章课程的详细信息


    $api->post('/notice', 'NoticeController@index'); //学习中心的用户通知模块---获取所有的通知信息

    $api->post('/notice/{id?}/{noticeType?}', 'NoticeController@show');//获取用户点击后的通知展示信息---还差视频直播的接口需要完成


    //******直播*********
    $api->post('/live/detail', 'LiveController@live_detail');              //直播详情页
    $api->post('/live', 'LiveController@index');                    //直播接口暂定
    $api->any('/live/notice', 'NoticeController@notice');                 //直播接口暂定
    $api->any('/live/test', 'LiveController@test');

    $api->any('/live/callback', 'LiveController@callback');

    $api->any('/live/get', 'LiveController@get');

    $api->any('/live/getHistoryMsg', 'LiveController@history');

    $api->any('/live/timUsers', 'LiveController@TimUsers');//直播间的人

    $api->any('/live/cs', 'LiveController@cs');

    $api->post('/study/info', 'LessonsCenterController@info');//学习中心的信息【通知与学习官那点事】


    //-------------处理用户发点赞，送花，用户添加评论---------------------------
    $api->any('/change/up_times/{type?}/{comment_id?}/{userPhone?}', 'UsersChangeController@change_up_times'); //用户评论点赞

    $api->any('/change/flower', 'UsersChangeController@change_flower_clo');//用户送花

    $api->any('change/article/{articleId?}/{userPhone?}', 'UsersChangeController@change_article_uptimes'); //文章点赞次数修改

    $api->post('change/addComments', 'UsersChangeController@add_comments');//用户添加评论的信息
    //用户api分享链接
    $api->any('/share/{id}', 'UsersChangeController@share');//用户分享链接

    //用户微信分享页面查看
    //$api->any('/share/info/{id}', 'UsersChangeController@info')->middleware('wxInfo');//用户的微信分享页面的查看

//    $api->any('/user/user_info', 'ShareController@user_info');

//    微信用户添加评论
//    $api->any('/wxUserAddComment', 'ShareController@wxUserAddComment')->middleware('cors');

    //---------------------------------------------v2接口优化--------------------------------------------------------
    

    $api->post('/delComment', 'ReadingPartyController@delComment');//删除某一个评论

    $api->post('/getImproveData', 'ReadingPartyController@getImproveData');//获取读书改进计划的详细的页面

    $api->post('/getReadPlanInfo', 'ReadingPartyController@getReadPlanInfo');//获取单条读书改进计划的信息


    $api->post('/getAllPartyMember', 'AddressListController@getAllMember');//通讯录信息优化

    $api->post('/getUserBookReadPlan', 'ReadingPartyController@get_user_book_read_plan');//获取用户单本书的读书改进计划

    $api->post('/getReadPartyMemberInfo', 'ReadingPartyController@getReadPartyMemberInfo'); //会员信息优化

    $api->post('/updateReadPartMember', 'AddressListController@update_read_party_member');//会员的个人信息的修改

    $api->post('/getDepartmentUser', 'AddressListController@getDepartmentUser');//优化部门管理员的显示信息---组织结构

    $api->post('/updateReadPartyMember', 'AddressListController@update_read_party_member');//学习官 管理员 添加部门的管理员



    $api->post('/delMemberUser', 'ReadingPartyController@delMemberUser');//删除成员---学习官与管理员的---该接口已经存在了不需要修改

    $api->post('/assignmentAdmin', 'ReadingPartyController@assignmentAdmin');//管理员转让管理员的权限

   

    $api->post('/reward', 'ReadingPartyController@reward');//读书会打赏

    

    $api->post('/remarkNotice', 'ReadingPartyController@remarkNotice');//标记用户通知为已读


    $api->post('/detailStudyInfo', 'ReadingPartyController@detail_study_info');        //名师榜 详细的学习信息
    $api->post('/pageIntegralRankList', 'ReadingPartyController@page_integral_rank_list');  //积分排名
    $api->post('/pageReadRankList', 'ReadingPartyController@page_read_rank_list');      //代读榜排名
    $api->post('/sendGift', 'ReadingPartyController@send_gift');                //赠送礼物
    $api->post('/allIntegralRank', 'ReadingPartyController@all_integral_rank');        //所有的积分排名

    /*===========多级评论公用 begin ==========*/

    $api->post('/comment/addComment',       'CommentController@add_comment');
    $api->post('/comment/getSingleComment', 'CommentController@get_single_comment');
    $api->post('/comment/getMultyComment',  'CommentController@get_multy_comment');
    $api->post('/comment/deleteComment',    'CommentController@delete_comment');
    $api->post('/comment/addOrCancelZan',   'CommentController@add_or_cancel_zan');

    /*===========多级评论公用 end   ==========*/

    $api->post('/clearInfoByName', 'MemberController@memberinfoByName');//根据用户手机号获取用户的用户的名字
    $api->post('/clearmemberinfoappkey', 'MemberController@clearappkey');//清除用户的appkey


    /*========== 微信支付 begin ==============*/
    $api->post('/weixin/getPayData',        'WeiXinController@get_pay_data');
    
    


    /*========== 微信支付 end ==============*/


});
